package com.atbeijing.D03;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class MyTest {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        DataStreamSource<String> stream = env.fromElements("1", "2", "3", "4");

        stream.shuffle().print().setParallelism(2);

        stream.rebalance().print().setParallelism(2);

        stream.rescale().print().setParallelism(2);

        env.execute();
    }
}
